/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.hpvas.gui.internalframe;

import edu.hpvas.control.PetController;
import edu.hpvas.persistence.entity.Pet;
import java.awt.Color;
import java.util.ArrayList;
import javax.swing.Icon;
import javax.swing.JLabel;

/**
 *
 * @author sony
 */
public class PetInternalFrame extends javax.swing.JInternalFrame {
    
    //private PetSearchframe petSearchframe= new PetSearchframe();
    private PetCreateFrame petCreate = new PetCreateFrame();
    private PetUpdateInf petUpdate = new PetUpdateInf();
    private PetDeleteFrame petDelete = new PetDeleteFrame();
    /**
     * Creates new form PetInternalFrame
     */
    public PetInternalFrame() {
        initComponents();
        int ancho=780;
        int alto=550;
        setSize(ancho, alto);
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToolBar3 = new javax.swing.JToolBar();
        jButton1 = new javax.swing.JButton();
        updateJB = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        petsPanel = new javax.swing.JDesktopPane();

        jToolBar3.setRollover(true);

        jButton1.setForeground(new java.awt.Color(0, 0, 153));
        jButton1.setText("Add a Pet");
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setPreferredSize(new java.awt.Dimension(80, 25));
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton1);

        updateJB.setForeground(new java.awt.Color(0, 0, 153));
        updateJB.setText("UpdatePet");
        updateJB.setFocusable(false);
        updateJB.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        updateJB.setPreferredSize(new java.awt.Dimension(80, 25));
        updateJB.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        updateJB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateJBActionPerformed(evt);
            }
        });
        jToolBar3.add(updateJB);

        jButton3.setForeground(new java.awt.Color(0, 0, 153));
        jButton3.setText("Delete");
        jButton3.setFocusable(false);
        jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton3.setPreferredSize(new java.awt.Dimension(80, 25));
        jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton3);

        petsPanel.setBackground(new java.awt.Color(240, 240, 240));
        petsPanel.setForeground(new java.awt.Color(240, 240, 240));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(petsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 700, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(78, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(petsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 500, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(66, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
         petsPanel.setVisible(false);
        petsPanel.removeAll();
        petCreate.setVisible(true);
        petsPanel.add(petCreate);
        petsPanel.setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void updateJBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateJBActionPerformed
      
        petsPanel.setVisible(false);
        petsPanel.removeAll();
        petUpdate.setVisible(true);
        petsPanel.add(petUpdate);
        petsPanel.setVisible(true);
    }//GEN-LAST:event_updateJBActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        petDelete.setVisible(true);
        
    }//GEN-LAST:event_jButton3ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton3;
    private javax.swing.JToolBar jToolBar3;
    private javax.swing.JDesktopPane petsPanel;
    private javax.swing.JButton updateJB;
    // End of variables declaration//GEN-END:variables
}
